package com.rjjh.springmvc.easymvc;

import java.util.HashMap;
import java.util.Map;

/**
 * 用来封装结果的模型数据和结果视图
 */
public class ModelAndView {

    private String viewName;
    private Map<String, Object> model = new HashMap<>();

    public void setViewName(String viewName) {
        this.viewName = viewName;
    }

    public ModelAndView addObject(String attributeName, Object attributeValue) {
        this.model.put(attributeName, attributeValue);
        return this;
    }

    public String getViewName() {
        return viewName;
    }

    public Map<String, Object> getModel() {
        return model;
    }

}
